package net.lmc.realtime.traffic.mapper;

import net.lmc.realtime.traffic.bean.TrafficFlowBean;
import net.lmc.realtime.traffic.bean.TrafficFlowTypeBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TrafficFlowMapper {

    @Select("SELECT\n" +
            "    camera_id ,\n" +
            "    SUM(vehicle_type_count) license_plate_count\n" +
            "FROM traffic_monitoring.dws_traffic_flow_type_report_total\n" +
            "WHERE toDate(window_start_time) = #{date} \n" +
            "GROUP BY camera_id ORDER BY license_plate_count DESC Limit 4")
    List<TrafficFlowBean> SelectFlowCardCount(String date);

    @Select("SELECT\n" +
            "    vehicle_type ,\n" +
            "    SUM(vehicle_type_count) vehicle_type_count\n" +
            "FROM traffic_monitoring.dws_traffic_flow_type_report_total\n" +
            "WHERE toDate(window_start_time) = #{date}\n" +
            "GROUP BY vehicle_type")
    List<TrafficFlowTypeBean> SelectFlowCardTypeCount(String date);
}
